Skip to content

Fix unsound compat01as03 implementation (fixes #2514)#3012

Open
stbuehler wants to merge 1 commit into
rust-lang:masterfrom
stbuehler:fix-miri-compat-2514
Open

Fix unsound compat01as03 implementation (fixes #2514)#3012
stbuehler wants to merge 1 commit into
rust-lang:masterfrom
stbuehler:fix-miri-compat-2514

Conversation

@stbuehler

Copy link
Copy Markdown
Contributor

Miri complains:

Undefined Behavior: trying to retag [...] for SharedReadWrite
permission [...], but that tag only grants SharedReadOnly permission for
this location

in the UnsafeNotify01::drop_raw implementation for NotifyWaker.

drop_raw should receive a *mut Self, but that isn't dyn compatible; it receives &Self instead (as documented by futures01 UnsafeNotify::drop_raw).

Wrap in and access through UnsafeCell to fix the undefined behavior.

Miri complains:

> Undefined Behavior: trying to retag [...] for SharedReadWrite
> permission [...], but that tag only grants SharedReadOnly permission for
> this location

in the UnsafeNotify01::drop_raw implementation for NotifyWaker.

drop_raw should receive a `*mut Self`, but that isn't dyn compatible; it
receives `&Self` instead (as documented by futures01
UnsafeNotify::drop_raw).

Wrap in and access through UnsafeCell to fix the undefined behavior.
@rustbot rustbot added A-compat Area: futures::compat S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compat Area: futures::compat S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants